//
//  BannerCell.swift
//  E-CycleForShop
//
//  Created by enghou on 17/3/2.
//  Copyright © 2017年 xyxorigation. All rights reserved.
//

import UIKit
class BannerItemModel : NSObject {
    var pic : String = ""
    var url : String = ""
    init(source : Dictionary<String,Any>) {
        super.init()
        if let picc = source["picture"] as? String {
            pic = picc
        }
        if let cnt = source["content"] as? String {
            url = cnt;
        }
    }
}

class BannerCell: UICollectionViewCell {
    var model : BannerItemModel? {
        didSet{
            //如果该cell是重复的 则该图片应该是之前的图片
            image.setImage(url: model!.pic)
        }
    }
    
    private let image = UIImageView.init()
    
    override func awakeFromNib() {
        super.awakeFromNib()
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        image.frame = self.bounds
        image.backgroundColor = UIColor.colorWithHexString(hex: "fcfcfc")
        self.contentView.addSubview(image)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
